<template>
  <div class="app-container home">
    <!-- 顶部横幅 -->
    <section class="hero-section">
      <div class="hero-content" v-scroll-animation>
        <h1>团建活动管理平台</h1>
        <p>凝聚团队力量，创造美好回忆</p>
        <el-button type="primary" size="large" @click="scrollToActivities">探索活动</el-button>
      </div>
    </section>

    <!-- 团建优势 -->
    <section class="advantages-section" ref="advantagesSection">
      <h2 class="section-title" v-scroll-animation>团建优势</h2>
      <div class="advantages-grid">
        <div class="advantage-card" v-for="(advantage, index) in advantages" :key="index" v-scroll-animation>
          <div class="advantage-icon">
            <i :class="advantage.icon"></i>
          </div>
          <h3>{{ advantage.title }}</h3>
          <p>{{ advantage.description }}</p>
        </div>
      </div>
    </section>

    <!-- 活动类型 -->
    <section class="activities-section" ref="activitiesSection">
      <h2 class="section-title" v-scroll-animation>活动类型</h2>
      <div class="activities-container">
        <div class="activity-card" v-for="(activity, index) in activities" :key="index" v-scroll-animation>
          <div class="activity-image">
            <img :src="activity.image" :alt="activity.title">
          </div>
          <div class="activity-info">
            <h3>{{ activity.title }}</h3>
            <p>{{ activity.description }}</p>
            <el-button type="text" @click="goTarget(activity.link)">了解更多</el-button>
          </div>
        </div>
      </div>
    </section>

    <!-- 团建流程 -->
    <section class="process-section">
      <h2 class="section-title" v-scroll-animation>团建流程</h2>
      <div class="process-timeline">
        <div class="process-step" v-for="(step, index) in steps" :key="index" v-scroll-animation>
          <div class="step-number">{{ index + 1 }}</div>
          <div class="step-content">
            <h3>{{ step.title }}</h3>
            <p>{{ step.description }}</p>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "3.8.7",
      advantages: [
        {
          icon: "el-icon-medal",
          title: "提升团队凝聚力",
          description: "通过精心设计的活动增强团队成员间的信任与合作"
        },
        {
          icon: "el-icon-data-line",
          title: "提高工作效率",
          description: "放松心情，释放压力，回归工作更加充满活力"
        },
        {
          icon: "el-icon-chat-line-round",
          title: "改善沟通能力",
          description: "在轻松环境中促进团队成员间的有效沟通"
        }
      ],
      activities: [
        {
          title: "户外拓展",
          description: "挑战自我，突破极限，在户外活动中培养团队协作精神",
          image: require("@/assets/team-building.svg"),
          link: "/reunion/activity"
        },
        {
          title: "室内团建",
          description: "丰富多彩的室内活动，激发创造力与团队默契",
          image: require("@/assets/team-building-animation.svg"),
          link: "/reunion/activity"
        },
        {
          title: "主题派对",
          description: "定制各类主题派对，创造难忘的团队记忆",
          image: require("@/assets/team-building.svg"),
          link: "/reunion/activity"
        }
      ],
      steps: [
        {
          title: "需求沟通",
          description: "了解团队需求，确定活动目标和预期效果"
        },
        {
          title: "方案定制",
          description: "根据需求定制专属团建方案，包括活动内容和场地选择"
        },
        {
          title: "活动预约",
          description: "确认方案后进行活动预约，锁定时间和场地"
        },
        {
          title: "活动执行",
          description: "专业团队全程服务，确保活动顺利进行"
        }
      ]
    };
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    scrollToActivities() {
      this.$refs.activitiesSection.scrollIntoView({ behavior: 'smooth' });
    }
  },
  directives: {
    scrollAnimation: {
      inserted: function (el) {
        const observer = new IntersectionObserver(
          (entries) => {
            entries.forEach(entry => {
              if (entry.isIntersecting) {
                el.classList.add('animate');
                observer.unobserve(el);
              }
            });
          },
          { threshold: 0.1 }
        );
        observer.observe(el);
      }
    }
  }
};
</script>

<style scoped lang="scss">
.home {
  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #676a6c;
  overflow-x: hidden;

  section {
    padding: 60px 20px;
    margin-bottom: 40px;
  }

  .section-title {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 40px;
    color: #2c3e50;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;

    &.animate {
      opacity: 1;
      transform: translateY(0);
    }
  }

  // 顶部横幅样式
  .hero-section {
    height: 80vh;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    margin-bottom: 0;

    .hero-content {
      opacity: 0;
      transform: translateY(20px);
      transition: all 0.6s ease;

      &.animate {
        opacity: 1;
        transform: translateY(0);
      }

      h1 {
        font-size: 3.5em;
        margin-bottom: 20px;
        font-weight: 300;
      }

      p {
        font-size: 1.5em;
        margin-bottom: 30px;
      }
    }
  }

  // 团建优势样式
  .advantages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;

    .advantage-card {
      background: white;
      border-radius: 8px;
      padding: 30px;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
      text-align: center;
      transition: all 0.3s ease;
      opacity: 0;
      transform: translateY(20px);

      &.animate {
        opacity: 1;
        transform: translateY(0);
      }

      &:hover {
        transform: translateY(-10px);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
      }

      .advantage-icon {
        font-size: 3em;
        color: #409EFF;
        margin-bottom: 20px;
      }

      h3 {
        font-size: 1.5em;
        margin-bottom: 15px;
        color: #2c3e50;
      }

      p {
        color: #666;
        line-height: 1.6;
      }
    }
  }

  // 活动类型样式
  .activities-section {
    background-color: #f9f9f9;
  }

  .activities-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;

    .activity-card {
      width: 100%;
      max-width: 350px;
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      opacity: 0;
      transform: translateY(20px);

      &.animate {
        opacity: 1;
        transform: translateY(0);
      }

      &:hover {
        transform: translateY(-10px);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
      }

      .activity-image {
        height: 200px;
        overflow: hidden;

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          transition: transform 0.5s ease;
        }

        &:hover img {
          transform: scale(1.05);
        }
      }

      .activity-info {
        padding: 20px;

        h3 {
          font-size: 1.5em;
          margin-bottom: 10px;
          color: #2c3e50;
        }

        p {
          color: #666;
          margin-bottom: 15px;
          line-height: 1.6;
        }
      }
    }
  }

  // 团建流程样式
  .process-section {
    background: linear-gradient(to right, #f6f9fc, #eef1f5);
  }

  .process-timeline {
    max-width: 800px;
    margin: 0 auto;
    position: relative;

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 20px;
      height: 100%;
      width: 4px;
      background: #409EFF;

      @media (min-width: 768px) {
        left: 50%;
        transform: translateX(-50%);
      }
    }

    .process-step {
      position: relative;
      margin-bottom: 50px;
      display: flex;
      opacity: 0;
      transform: translateY(20px);
      transition: all 0.6s ease;

      &.animate {
        opacity: 1;
        transform: translateY(0);
      }

      .step-number {
        width: 40px;
        height: 40px;
        background: #409EFF;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
        z-index: 1;
        margin-right: 20px;

        @media (min-width: 768px) {
          position: absolute;
          left: 50%;
          transform: translateX(-50%);
          margin-right: 0;
        }
      }

      .step-content {
        background: white;
        padding: 20px;
        border-radius: 8px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        flex: 1;

        @media (min-width: 768px) {
          width: 45%;
          margin-left: auto;
          margin-right: 0;

          &:nth-child(odd) {
            margin-left: 0;
            margin-right: auto;
            text-align: right;
          }
        }

        h3 {
          color: #2c3e50;
          margin-bottom: 10px;
        }

        p {
          color: #666;
          line-height: 1.6;
        }
      }

      &:nth-child(even) {
        @media (min-width: 768px) {
          flex-direction: row-reverse;

          .step-content {
            margin-left: 0;
            margin-right: auto;
            text-align: right;
          }
        }
      }
    }
  }

  // 基础样式
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }

  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }

  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }

  // 动画效果
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes pulse {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
    100% {
      transform: scale(1);
    }
  }
}
</style>

